#ifndef MAIN_WINDOW_H
#define MAIN_WINDOW_H

#include <QMainWindow>

class QLabel;

class MidiPlayerWidget;
class ConstraintsWidget;
class ScoreWidget;

class MusicSettings;

/*!
 * Fenêtre principale de d'application
 */
class MainWindow: public QMainWindow {
  Q_OBJECT;

  public:
    MainWindow(QWidget *parent = 0);
    ~MainWindow();

  protected:
    void closeEvent(QCloseEvent *);

  private:
    QMenu *fileMenu;
    QMenu *settingsMenu;
    QMenu *scaleMenu;
    QMenu *helpMenu;

    QAction *newMelodyAction;
    QAction *saveSettingsAction;
    QAction *loadSettingsAction;
    QAction *exportLyAction;
    QAction *exportMIDIAction;
    QAction *exportPDFAction;
    QAction *quitAction;

    QAction *scoreSettingAction;
    QAction *tempoSettingAction;
    QAction *scaleModeSettingAction;
    QAction *ascendingScaleSettingAction;
    QAction *descendingScaleSettingAction;
    QAction *firstNoteSettingAction;
    QAction *patternSettingAction;
    QAction *miscSettingAction;

    QAction *aboutAction;

    QLabel *statusBarLabel;

    MidiPlayerWidget *midiPlayerWidget;
    ScoreWidget *scoreWidget;
    ConstraintsWidget *constraintsWidget;

    MusicSettings *settings;

    void createActions();
    void createMenus();

    void cleanFiles();

  public slots:
    void generate();

  private slots:
    void about();

    void notReady();
    void ready();

    void changeStatusBar(const QString &);

    void newMelody();
    void newMelodyInit();
    void saveSettings();
    void loadSettings();
    void exportLy();
    void exportMIDI();
    void exportPDF();

    void scoreSetting();
    void tempoSetting();
    void scaleModeSetting();
    void ascendingScaleSetting();
    void descendingScaleSetting();
    void firstNoteSetting();
    void patternSetting();
    void miscSetting();
};

#endif
